package com.yhq.basic.thread;

/**
 * @author hqyin
 * @date 2023/11/29 11:33 AM
 */
public class ShowThreadState {
    public static void main(String[] args) {
        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.interrupted();
                    Thread.sleep(10000);
                } catch (InterruptedException e) {
                    e.printStackTrace();

//                    System.out.println("中断异常："+Thread.currentThread().isInterrupted());
                }
            }
        },"t1");
        t1.start();


        System.out.println("中断前状态："+t1.isInterrupted());
//        t1.interrupt();
        System.out.println("t1中断");
        System.out.println("中断前状态："+t1.isInterrupted());

    }

}
